<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Reset Activity</title>
<link rel="stylesheet" type="text/css"
	href="includes/js/jquery/themes/metro-orange/easyui.css">
<link rel="stylesheet" type="text/css"
	href="includes/js/jquery/themes/icon.css">
<script type="text/javascript" src="includes/js/jquery/jquery.min.js"></script>
<script type="text/javascript"
	src="includes/js/jquery/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="includes/js/jquery/datagrid-detailview.js"></script>

<link href="includes/css/report.css" rel="stylesheet" type="text/css">
</head>
<body>
	<table id="dg" style="width: 600px; height: 250px"
		url="getOpportunityDetails.htm?itemid=${itemid}&userid=${userid}" singleSelect="true" fitColumns="true">
		<thead>
			<tr>
				<th field="id" width="50" hidden="true">Id</th>
				<th field="itemid" width="100">Item Id</th>
				<th field="completedon" width="60">Completed On</th>
				<th field="completedby" width="60">Completed By</th>
				<th field="status" width="80">Action Taken</th>
			</tr>
		</thead>
	</table>

	<script type="text/javascript">
		$(function() {
			$('#dg').datagrid({
				toolbar : toolbar,
				rownumbers : true,
				singleSelect : true
			});
		});

		var toolbar = [
				{
					text : 'Reset',
					iconCls : 'icon-reset',
					handler : function() {
						var row = $('#dg').datagrid('getSelected');
						if(row.status != 'Rejected By PRC'){
							$.messager.alert('Cannot Proceed','Approved Activities cannot be Undone');
						}else{
						$.ajax({
							url : "ResetActivity.htm?activityid=" + row.id,
							complete : function(){
								$.messager.alert('Reset Activity','Reset Selected Activity' ,'info', function(){
									location.reload();
								});	}
						});
						}
					}
				} ];

	</script>
</body>
</html>